Analyse des lycées franciliens

Library

library(dplyr)
## 
## Attaching package: 'dplyr'
## 
## The following objects are masked from 'package:stats':
## 
##     filter, lag
## 
## The following objects are masked from 'package:base':
## 
##     intersect, setdiff, setequal, union
library(tidyr)
library(ade4)
library(adegraphics)
## 
## Attaching package: 'adegraphics'
## 
## The following objects are masked from 'package:ade4':
## 
##     kplotsepan.coa, s.arrow, s.class, s.corcircle, s.distri,
##     s.image, s.label, s.logo, s.match, s.traject, s.value,
##     table.value, triangle.class
library(ggplot2)
## Warning: package 'ggplot2' was built under R version 3.2.2
library(foreign)
## Warning: package 'foreign' was built under R version 3.2.2
library(doBy)
## Warning: package 'doBy' was built under R version 3.2.2
## Loading required package: survival
mb5 <- read.csv("C:/Users/Antoine/Desktop/mb5.csv")
df <- mb5

Check

df2 <- na.omit(df)

head(df)
##   session  numetab                      patronyme   com   sensible
## 1    1997 0750105G COURS DU SOIR POUR ADULTES     75102        NON
## 2    1998 0750105G COURS DU SOIR POUR ADULTES     75102        NON
## 3    1999 0750105G COURS DU SOIR POUR ADULTES     75102        NON
## 4    2000 0750105G COURS DU SOIR POUR ADULTES     75102        NON
## 5    2001 0750105G COURS DU SOIR POUR ADULTES     75102 SANS OBJET
## 6    2002 0750105G COURS DU SOIR POUR ADULTES     75102 SANS OBJET
##         id_etab tot_inscrits    psucc p_cs1    p_cs2     p_cs3      p_cs4
## 1 0750105G_1997          111 44.14415     0 2.702703  1.801802  2.7027028
## 2 0750105G_1998          129 55.81395     0 3.875969 11.627907  0.7751938
## 3 0750105G_1999           99 55.55556     0 3.030303 12.121212  5.0505052
## 4 0750105G_2000           94 52.12766     0 2.127660 12.765958  0.0000000
## 5 0750105G_2001           80 48.75000     0 1.250000  7.500000  2.5000000
## 6 0750105G_2002           72 40.27778     0 6.944445  6.944445 11.1111110
##        p_cs5    p_cs6     p_cs7      p_cs8     p_cs9 cep   tx_btb cep2
## 1  0.9009009 0.000000 0.0000000  0.9009009 90.990990   0 2.040816    0
## 2  6.2015505 0.000000 0.7751938  2.3255813 74.418602   0 0.000000    0
## 3  6.0606060 4.040404 1.0101010  0.0000000 68.686867   0 0.000000    0
## 4  0.0000000 1.063830 1.0638298  1.0638298 81.914894   0 2.040816    0
## 5  2.5000000 5.000000 0.0000000  1.2500000 80.000000   0 2.564103    0
## 6 38.8888890 4.166666 0.0000000 25.0000000  6.944445   0 3.448276    0
##   depa    ps_es     ps_l     ps_s tx_btb_es tx_btb_l tx_btb_s
## 1   75 33.33333 53.84615 44.44444   0.00000 4.761905        0
## 2   75 59.52381 61.36364 46.51163   0.00000 0.000000        0
## 3   75 48.48485 61.29032 57.14286   0.00000 0.000000        0
## 4   75 60.71429 45.45454 51.51515   0.00000 6.666666        0
## 5   75 36.00000 61.53846 48.27586   0.00000 6.250000        0
## 6   75 34.61538 58.33333 27.27273  11.11111 0.000000        0
head(df2)
##   session  numetab                      patronyme   com   sensible
## 1    1997 0750105G COURS DU SOIR POUR ADULTES     75102        NON
## 2    1998 0750105G COURS DU SOIR POUR ADULTES     75102        NON
## 3    1999 0750105G COURS DU SOIR POUR ADULTES     75102        NON
## 4    2000 0750105G COURS DU SOIR POUR ADULTES     75102        NON
## 5    2001 0750105G COURS DU SOIR POUR ADULTES     75102 SANS OBJET
## 6    2002 0750105G COURS DU SOIR POUR ADULTES     75102 SANS OBJET
##         id_etab tot_inscrits    psucc p_cs1    p_cs2     p_cs3      p_cs4
## 1 0750105G_1997          111 44.14415     0 2.702703  1.801802  2.7027028
## 2 0750105G_1998          129 55.81395     0 3.875969 11.627907  0.7751938
## 3 0750105G_1999           99 55.55556     0 3.030303 12.121212  5.0505052
## 4 0750105G_2000           94 52.12766     0 2.127660 12.765958  0.0000000
## 5 0750105G_2001           80 48.75000     0 1.250000  7.500000  2.5000000
## 6 0750105G_2002           72 40.27778     0 6.944445  6.944445 11.1111110
##        p_cs5    p_cs6     p_cs7      p_cs8     p_cs9 cep   tx_btb cep2
## 1  0.9009009 0.000000 0.0000000  0.9009009 90.990990   0 2.040816    0
## 2  6.2015505 0.000000 0.7751938  2.3255813 74.418602   0 0.000000    0
## 3  6.0606060 4.040404 1.0101010  0.0000000 68.686867   0 0.000000    0
## 4  0.0000000 1.063830 1.0638298  1.0638298 81.914894   0 2.040816    0
## 5  2.5000000 5.000000 0.0000000  1.2500000 80.000000   0 2.564103    0
## 6 38.8888890 4.166666 0.0000000 25.0000000  6.944445   0 3.448276    0
##   depa    ps_es     ps_l     ps_s tx_btb_es tx_btb_l tx_btb_s
## 1   75 33.33333 53.84615 44.44444   0.00000 4.761905        0
## 2   75 59.52381 61.36364 46.51163   0.00000 0.000000        0
## 3   75 48.48485 61.29032 57.14286   0.00000 0.000000        0
## 4   75 60.71429 45.45454 51.51515   0.00000 6.666666        0
## 5   75 36.00000 61.53846 48.27586   0.00000 6.250000        0
## 6   75 34.61538 58.33333 27.27273  11.11111 0.000000        0

Formatting

df$session <- as.factor(df$session)
df$cep2    <- as.factor(df$cep2)
df$cep     <- as.factor(df$cep)
df$depa    <- as.factor(df$depa)

Sorting

attach(df)

df2 <- df[order(id_etab),]
dcs <- df2

Subset

df97 <- filter(df, session=="1997")
df98 <- filter(df, session=="1998")
df99 <- filter(df, session=="1999")
df00 <- filter(df, session=="2000")
df01 <- filter(df, session=="2001")
df02 <- filter(df, session=="2002")
df03 <- filter(df, session=="2003")
df04 <- filter(df, session=="2004")
df05 <- filter(df, session=="2005")
df06 <- filter(df, session=="2006")
df07 <- filter(df, session=="2007")
df08 <- filter(df, session=="2008")
df09 <- filter(df, session=="2009")
df10 <- filter(df, session=="2010")
df11 <- filter(df, session=="2011")
df12 <- filter(df, session=="2012")
df13 <- filter(df, session=="2013")
df14 <- filter(df, session=="2014")

Selection

df97s <- select(df97, p_cs2, p_cs3, p_cs4, p_cs5, p_cs6, p_cs7, p_cs8, p_cs9 , psucc, tx_btb)
df98s <- select(df98, p_cs2, p_cs3, p_cs4, p_cs5, p_cs6, p_cs7, p_cs8, p_cs9 , psucc, tx_btb)
df99s <- select(df99, p_cs2, p_cs3, p_cs4, p_cs5, p_cs6, p_cs7, p_cs8, p_cs9 , psucc, tx_btb)
df00s <- select(df00, p_cs2, p_cs3, p_cs4, p_cs5, p_cs6, p_cs7, p_cs8, p_cs9 , psucc, tx_btb)
df01s <- select(df01, p_cs2, p_cs3, p_cs4, p_cs5, p_cs6, p_cs7, p_cs8, p_cs9 , psucc, tx_btb)
df02s <- select(df02, p_cs2, p_cs3, p_cs4, p_cs5, p_cs6, p_cs7, p_cs8, p_cs9 , psucc, tx_btb)
df03s <- select(df03, p_cs2, p_cs3, p_cs4, p_cs5, p_cs6, p_cs7, p_cs8, p_cs9 , psucc, tx_btb)
df04s <- select(df04, p_cs2, p_cs3, p_cs4, p_cs5, p_cs6, p_cs7, p_cs8, p_cs9 , psucc, tx_btb)
df05s <- select(df05, p_cs2, p_cs3, p_cs4, p_cs5, p_cs6, p_cs7, p_cs8, p_cs9 , psucc, tx_btb)
df06s <- select(df06, p_cs2, p_cs3, p_cs4, p_cs5, p_cs6, p_cs7, p_cs8, p_cs9 , psucc, tx_btb)
df07s <- select(df07, p_cs2, p_cs3, p_cs4, p_cs5, p_cs6, p_cs7, p_cs8, p_cs9 , psucc, tx_btb)
df08s <- select(df08, p_cs2, p_cs3, p_cs4, p_cs5, p_cs6, p_cs7, p_cs8, p_cs9 , psucc, tx_btb)
df09s <- select(df09, p_cs2, p_cs3, p_cs4, p_cs5, p_cs6, p_cs7, p_cs8, p_cs9 , psucc, tx_btb)
df10s <- select(df10, p_cs2, p_cs3, p_cs4, p_cs5, p_cs6, p_cs7, p_cs8, p_cs9 , psucc, tx_btb)
df11s <- select(df11, p_cs2, p_cs3, p_cs4, p_cs5, p_cs6, p_cs7, p_cs8, p_cs9 , psucc, tx_btb)
df12s <- select(df12, p_cs2, p_cs3, p_cs4, p_cs5, p_cs6, p_cs7, p_cs8, p_cs9 , psucc, tx_btb)
df13s <- select(df13, p_cs2, p_cs3, p_cs4, p_cs5, p_cs6, p_cs7, p_cs8, p_cs9 , psucc, tx_btb)
df14s <- select(df14, p_cs2, p_cs3, p_cs4, p_cs5, p_cs6, p_cs7, p_cs8, p_cs9 , psucc, tx_btb)
df97i <- select(df97, p_cs2, p_cs3, p_cs4, p_cs5, p_cs6, p_cs7, p_cs8, p_cs9 )
df98i <- select(df98, p_cs2, p_cs3, p_cs4, p_cs5, p_cs6, p_cs7, p_cs8, p_cs9 )
df99i <- select(df99, p_cs2, p_cs3, p_cs4, p_cs5, p_cs6, p_cs7, p_cs8, p_cs9 )
df00i <- select(df00, p_cs2, p_cs3, p_cs4, p_cs5, p_cs6, p_cs7, p_cs8, p_cs9 )
df01i <- select(df01, p_cs2, p_cs3, p_cs4, p_cs5, p_cs6, p_cs7, p_cs8, p_cs9 )
df02i <- select(df02, p_cs2, p_cs3, p_cs4, p_cs5, p_cs6, p_cs7, p_cs8, p_cs9 )
df03i <- select(df03, p_cs2, p_cs3, p_cs4, p_cs5, p_cs6, p_cs7, p_cs8, p_cs9 )
df04i <- select(df04, p_cs2, p_cs3, p_cs4, p_cs5, p_cs6, p_cs7, p_cs8, p_cs9 )
df05i <- select(df05, p_cs2, p_cs3, p_cs4, p_cs5, p_cs6, p_cs7, p_cs8, p_cs9 )
df06i <- select(df06, p_cs2, p_cs3, p_cs4, p_cs5, p_cs6, p_cs7, p_cs8, p_cs9 )
df07i <- select(df07, p_cs2, p_cs3, p_cs4, p_cs5, p_cs6, p_cs7, p_cs8, p_cs9 )
df08i <- select(df08, p_cs2, p_cs3, p_cs4, p_cs5, p_cs6, p_cs7, p_cs8, p_cs9 )
df09i <- select(df09, p_cs2, p_cs3, p_cs4, p_cs5, p_cs6, p_cs7, p_cs8, p_cs9 )
df10i <- select(df10, p_cs2, p_cs3, p_cs4, p_cs5, p_cs6, p_cs7, p_cs8, p_cs9 )
df11i <- select(df11, p_cs2, p_cs3, p_cs4, p_cs5, p_cs6, p_cs7, p_cs8, p_cs9 )
df12i <- select(df12, p_cs2, p_cs3, p_cs4, p_cs5, p_cs6, p_cs7, p_cs8, p_cs9 )
df13i <- select(df13, p_cs2, p_cs3, p_cs4, p_cs5, p_cs6, p_cs7, p_cs8, p_cs9 )
df14i <- select(df14, p_cs2, p_cs3, p_cs4, p_cs5, p_cs6, p_cs7, p_cs8, p_cs9 )

Scaling

wdf97 <- data.frame(scalewt(df97i, wt=df97$tot_inscrits))
wdf98 <- data.frame(scalewt(df98i, wt=df98$tot_inscrits))
wdf99 <- data.frame(scalewt(df99i, wt=df99$tot_inscrits))
wdf00 <- data.frame(scalewt(df00i, wt=df00$tot_inscrits))
wdf01 <- data.frame(scalewt(df01i, wt=df01$tot_inscrits))
wdf02 <- data.frame(scalewt(df02i, wt=df02$tot_inscrits))
wdf03 <- data.frame(scalewt(df03i, wt=df03$tot_inscrits))
wdf04 <- data.frame(scalewt(df04i, wt=df04$tot_inscrits))
wdf05 <- data.frame(scalewt(df05i, wt=df05$tot_inscrits))
wdf06 <- data.frame(scalewt(df06i, wt=df06$tot_inscrits))
wdf07 <- data.frame(scalewt(df07i, wt=df07$tot_inscrits))
wdf08 <- data.frame(scalewt(df08i, wt=df08$tot_inscrits))
wdf09 <- data.frame(scalewt(df09i, wt=df09$tot_inscrits))
wdf10 <- data.frame(scalewt(df10i, wt=df10$tot_inscrits))
wdf11 <- data.frame(scalewt(df11i, wt=df11$tot_inscrits))
wdf12 <- data.frame(scalewt(df12i, wt=df12$tot_inscrits))
wdf13 <- data.frame(scalewt(df13i, wt=df13$tot_inscrits))
wdf14 <- data.frame(scalewt(df14i, wt=df14$tot_inscrits))
wdf97x <- data.frame(scalewt(df97s, wt=df97$tot_inscrits))
wdf98x <- data.frame(scalewt(df98s, wt=df98$tot_inscrits))
wdf99x <- data.frame(scalewt(df99s, wt=df99$tot_inscrits))
wdf00x <- data.frame(scalewt(df00s, wt=df00$tot_inscrits))
wdf01x <- data.frame(scalewt(df01s, wt=df01$tot_inscrits))
wdf02x <- data.frame(scalewt(df02s, wt=df02$tot_inscrits))
wdf03x <- data.frame(scalewt(df03s, wt=df03$tot_inscrits))
wdf04x <- data.frame(scalewt(df04s, wt=df04$tot_inscrits))
wdf05x <- data.frame(scalewt(df05s, wt=df05$tot_inscrits))
wdf06x <- data.frame(scalewt(df06s, wt=df06$tot_inscrits))
wdf07x <- data.frame(scalewt(df07s, wt=df07$tot_inscrits))
wdf08x <- data.frame(scalewt(df08s, wt=df08$tot_inscrits))
wdf09x <- data.frame(scalewt(df09s, wt=df09$tot_inscrits))
wdf10x <- data.frame(scalewt(df10s, wt=df10$tot_inscrits))
wdf11x <- data.frame(scalewt(df11s, wt=df11$tot_inscrits))
wdf12x <- data.frame(scalewt(df12s, wt=df12$tot_inscrits))
wdf13x <- data.frame(scalewt(df13s, wt=df13$tot_inscrits))
wdf14x <- data.frame(scalewt(df14s, wt=df14$tot_inscrits))

Labelling

row.names(wdf97x) <- df97$numetab
row.names(wdf98x) <- df98$numetab
row.names(wdf99x) <- df99$numetab
row.names(wdf00x) <- df00$numetab
row.names(wdf01x) <- df01$numetab
row.names(wdf02x) <- df02$numetab
row.names(wdf03x) <- df03$numetab
row.names(wdf04x) <- df04$numetab
row.names(wdf05x) <- df05$numetab
row.names(wdf06x) <- df06$numetab
row.names(wdf07x) <- df07$numetab
row.names(wdf08x) <- df08$numetab
row.names(wdf09x) <- df09$numetab
row.names(wdf10x) <- df10$numetab
row.names(wdf11x) <- df11$numetab
row.names(wdf12x) <- df12$numetab
row.names(wdf13x) <- df13$numetab
row.names(wdf14x) <- df14$numetab
row.names(wdf97) <- df97$numetab
row.names(wdf98) <- df98$numetab
row.names(wdf99) <- df99$numetab
row.names(wdf00) <- df00$numetab
row.names(wdf01) <- df01$numetab
row.names(wdf02) <- df02$numetab
row.names(wdf03) <- df03$numetab
row.names(wdf04) <- df04$numetab
row.names(wdf05) <- df05$numetab
row.names(wdf06) <- df06$numetab
row.names(wdf07) <- df07$numetab
row.names(wdf08) <- df08$numetab
row.names(wdf09) <- df09$numetab
row.names(wdf10) <- df10$numetab
row.names(wdf11) <- df11$numetab
row.names(wdf12) <- df12$numetab
row.names(wdf13) <- df13$numetab
row.names(wdf14) <- df14$numetab

Making K-Tab

lwdfx <- list(wdf97x, wdf98x, wdf99x, wdf00x, wdf01x, wdf02x, wdf03x, wdf04x, wdf05x, wdf06x, wdf07x, wdf08x, wdf09x, wdf10x, wdf11x, wdf12x, wdf13x, wdf14x)

kwdfx <- ktab.list.df(lwdfx)
lwdf <- list(wdf97, wdf98, wdf99, wdf00, wdf01, wdf02, wdf03, wdf04, wdf05, wdf06, wdf07, wdf08, wdf09, wdf10, wdf11, wdf12, wdf13, wdf14)

kwdf <- ktab.list.df(lwdf)

K - tables analysis (dfx : socio-scolaire)

K - tables analysis

  1. PTA
ptakwdfx <- pta(kwdfx, scannf = FALSE, nf=2)

plot(ptakwdfx)
s.class(ptakwdfx$Tli, df$numetab, col=rainbow(100))
s.traject(ptakwdfx$Tli, df$numetab, col=rainbow(100))
  1. MFA
mfakwdfx <- mfa(kwdfx, scannf = FALSE, nf=2)

plot(mfakwdfx)  
s.class(mfakwdfx$lisup, df$numetab, col=rainbow(100))
s.traject(mfakwdfx$lisup, df$numetab, col=rainbow(100))
  1. MCOA
mcoakwdfx <- mcoa(kwdf, scannf = FALSE, nf = 2)

plot(mcoakwdfx)
  1. STATIS
statiskwdfx <- statis(kwdfx, scannf = FALSE, nf = 2)

plot(statiskwdfx) 

K - tables analysis (df : social pure)

  1. PTA
ptakwdf <- pta(kwdf, scannf = FALSE, nf=2)

plot(ptakwdf) 
s.class(ptakwdf$Tli, df$numetab, col=rainbow(100))
s.traject(ptakwdf$Tli, df$numetab, col=rainbow(100))
  1. MFA
mfakwdf <- mfa(kwdf, scannf = FALSE, nf=2)

plot(mfakwdf) 
s.class(mfakwdf$lisup, df$numetab, col=rainbow(100))
s.traject(mfakwdf$lisup, df$numetab, col=rainbow(100))
  1. MCOA
mcoakwdf <- mcoa(kwdf, scannf = FALSE, nf = 2)

plot(mcoakwdf) 
  1. STATIS
statiskwdf <- statis(kwdf, scannf = FALSE, nf = 2)

plot(statiskwdf) 

Re-sorting

df2 <- df[order(session),]
head(df2)
##    session  numetab                      patronyme   com sensible
## 1     1997 0750105G COURS DU SOIR POUR ADULTES     75102      NON
## 19    1997 0750647W                         TURGOT 75103      NON
## 37    1997 0750648X                    VICTOR HUGO 75103      NON
## 55    1997 0750651A                    SIMONE WEIL 75103      NON
## 73    1997 0750652B                    CHARLEMAGNE 75104      NON
## 91    1997 0750653C                 SOPHIE GERMAIN 75104      NON
##          id_etab tot_inscrits    psucc     p_cs1     p_cs2     p_cs3
## 1  0750105G_1997          111 44.14415 0.0000000  2.702703  1.801802
## 19 0750647W_1997          181 69.06078 0.0000000 19.889503 29.281769
## 37 0750648X_1997          140 79.28571 0.0000000 12.142858 47.857143
## 55 0750651A_1997           25 64.00000 0.0000000 16.000000 44.000000
## 73 0750652B_1997          218 85.77982 0.0000000 11.467890 59.633026
## 91 0750653C_1997          235 58.29787 0.4255319 11.063829 35.319149
##        p_cs4      p_cs5     p_cs6    p_cs7     p_cs8     p_cs9 cep
## 1   2.702703  0.9009009  0.000000 0.000000 0.9009009 90.990990   0
## 19  8.839779 19.3370170 11.602210 1.657458 8.2872925  1.104972   0
## 37 12.857142 10.7142860  5.714286 5.000000 1.4285715  4.285714   0
## 55 16.000000  8.0000000  8.000000 8.000000 0.0000000  0.000000   0
## 73 13.302752  5.0458717  3.211009 0.000000 1.3761468  5.963303   0
## 91 18.297873 17.8723410  8.936171 1.276596 2.1276596  4.680851   0
##       tx_btb cep2 depa    ps_es     ps_l     ps_s tx_btb_es  tx_btb_l
## 1   2.040816    0   75 33.33333 53.84615 44.44444  0.000000  4.761905
## 19  2.400000    0   75 84.31373 73.07692 60.57692  2.325581  0.000000
## 37  3.603604    0   75       NA 85.33334 72.30769  0.000000  4.687500
## 55  0.000000    0   75 64.00000       NA       NA  0.000000  0.000000
## 73 15.508022    0   75       NA 94.87180 83.79888  0.000000 27.027027
## 91  0.000000    0   75 56.48148 65.21739 53.44828  0.000000  0.000000
##     tx_btb_s
## 1   0.000000
## 19  3.174603
## 37  2.127660
## 55  0.000000
## 73 12.666667
## 91  0.000000

Merging

xptakwdf    <- cbind(ptakwdf$Tli, df2)
xmcoakwdf   <- cbind(mcoakwdf$Tli, df2)
xptakwdfx    <- cbind(ptakwdfx$Tli, df2)
xmcoakwdfx   <- cbind(mcoakwdfx$Tli, df2)

Graphics

xptakwdf$session <- as.integer(xptakwdf$session)
xmcoakwdf$session <- as.integer(xmcoakwdf$session)

xptakwdfx$session <- as.integer(xptakwdfx$session)
xmcoakwdfx$session <- as.integer(xmcoakwdfx$session)
pptakwdf <- ggplot(xptakwdf, aes(CS1, CS2))
pptakwdf + geom_path()
cep_pptakwdf <- summaryBy(CS1 + CS2 ~ session + cep2, data = xptakwdf, FUN = function(x) { c(m = mean(x), s = sd(x)) } )

p_cep_pptakwdf <- ggplot(cep_pptakwdf, aes(CS1.m, CS2.m, label=session))

p_cep_pptakwdf + geom_text() + geom_path(aes(colour = session)) + facet_wrap( ~ cep2, ncol=1) + labs(title = "Trajectoire des établissements franciliens CEP et Non CEP - Modèle PTA Social pure")
pmcoakwdf <- ggplot(xmcoakwdf, aes(Axis1, Axis2))
pmcoakwdf + geom_path()
cep_pmcoakwdf <- summaryBy(Axis1 + Axis2 ~ session + cep2, data = xmcoakwdf, FUN = function(x) { c(m = mean(x), s = sd(x)) } )

p_cep_pmcoakwdf <- ggplot(cep_pmcoakwdf, aes(Axis1.m, Axis2.m, label=session))

p_cep_pmcoakwdf  + geom_text() +  geom_path(aes(colour = session)) + facet_wrap( ~ cep2, ncol=1) + labs(title = "Trajectoire des établissements franciliens CEP et Non CEP - Modèle MCOA Social pure")
pptakwdfx <- ggplot(xptakwdfx, aes(CS1, CS2))
pptakwdfx + geom_path()
cep_pptakwdfx <- summaryBy(CS1 + CS2 ~ session + cep2, data = xptakwdfx, FUN = function(x) { c(m = mean(x), s = sd(x)) } )


p_cep_pptakwdfx <- ggplot(cep_pptakwdfx, aes(CS1.m, CS2.m, label=session))

p_cep_pptakwdfx +  geom_text() +  geom_path(aes(colour = session)) + facet_wrap( ~ cep2, ncol=1) + labs(title = "Trajectoire des établissements franciliens CEP et Non CEP - Modèle PTA Socio-scolaire")
pmcoakwdfx <- ggplot(xmcoakwdfx, aes(Axis1, Axis2))
pmcoakwdfx + geom_path()
cep_pmcoakwdfx <- summaryBy(Axis1 + Axis2 ~ session + cep2, data = xmcoakwdfx, FUN = function(x) { c(m = mean(x), s = sd(x)) } )

p_cep_pmcoakwdfx <- ggplot(cep_pmcoakwdfx, aes(Axis1.m, Axis2.m, label=session))

p_cep_pmcoakwdfx   + geom_text()  + geom_path(aes(colour = session))  + facet_wrap( ~ cep2, ncol=1) + labs(title = "Trajectoire des établissements franciliens CEP et Non CEP - Modèle MCOA Socio-scolaire")

Analyse des CEP Uniquement

Loading Data

lyc <- read.csv("C:/Users/Antoine/Desktop/lyc.csv")
lyc <- na.omit(lyc)

Select subset

dcs <- select(lyc,  session, patronyme, id_etab, numetab, tot_inscrits, psucc, tx_btb, p_cs1, p_cs2, p_cs3, p_cs4, p_cs5, p_cs6, p_cs7, p_cs8, p_cs9, cep, cep2, codedep, codecom)

Sorting

attach(dcs)
## The following objects are masked from df:
## 
##     cep, cep2, id_etab, numetab, p_cs1, p_cs2, p_cs3, p_cs4,
##     p_cs5, p_cs6, p_cs7, p_cs8, p_cs9, patronyme, psucc, session,
##     tot_inscrits, tx_btb
dcs2 <- dcs[order(id_etab),]
dcs <- dcs2 

Filtering

d97 <- filter(dcs, session=="1997")
d98 <- filter(dcs, session=="1998")
d99 <- filter(dcs, session=="1999")
d00 <- filter(dcs, session=="2000")
d01 <- filter(dcs, session=="2001")
d02 <- filter(dcs, session=="2002")
d03 <- filter(dcs, session=="2003")
d04 <- filter(dcs, session=="2004")
d05 <- filter(dcs, session=="2005")
d06 <- filter(dcs, session=="2006")
d07 <- filter(dcs, session=="2007")
d08 <- filter(dcs, session=="2008")
d09 <- filter(dcs, session=="2009")
d10 <- filter(dcs, session=="2010")
d11 <- filter(dcs, session=="2011")
d12 <- filter(dcs, session=="2012")
d13 <- filter(dcs, session=="2013")
d14 <- filter(dcs, session=="2014")

Selecting

d97i <- select(d97, p_cs1:p_cs9)
d98i <- select(d98, p_cs1:p_cs9)
d99i <- select(d99, p_cs1:p_cs9)
d00i <- select(d00, p_cs1:p_cs9)
d01i <- select(d01, p_cs1:p_cs9)
d02i <- select(d02, p_cs1:p_cs9)
d03i <- select(d03, p_cs1:p_cs9)
d04i <- select(d04, p_cs1:p_cs9)
d05i <- select(d05, p_cs1:p_cs9)
d06i <- select(d06, p_cs1:p_cs9)
d07i <- select(d07, p_cs1:p_cs9)
d08i <- select(d08, p_cs1:p_cs9)
d09i <- select(d09, p_cs1:p_cs9)
d10i <- select(d10, p_cs1:p_cs9)
d11i <- select(d11, p_cs1:p_cs9)
d12i <- select(d12, p_cs1:p_cs9)
d13i <- select(d13, p_cs1:p_cs9)
d14i <- select(d14, p_cs1:p_cs9)

Scaling

wd97s <- data.frame(scalewt(d97i, wt=d97$tot_inscrits))
wd98s <- data.frame(scalewt(d98i, wt=d98$tot_inscrits))
wd99s <- data.frame(scalewt(d99i, wt=d99$tot_inscrits))
wd00s <- data.frame(scalewt(d00i, wt=d00$tot_inscrits))
wd01s <- data.frame(scalewt(d01i, wt=d01$tot_inscrits))
wd02s <- data.frame(scalewt(d02i, wt=d02$tot_inscrits))
wd03s <- data.frame(scalewt(d03i, wt=d03$tot_inscrits))
wd04s <- data.frame(scalewt(d04i, wt=d04$tot_inscrits))
wd05s <- data.frame(scalewt(d05i, wt=d05$tot_inscrits))
wd06s <- data.frame(scalewt(d06i, wt=d06$tot_inscrits))
wd07s <- data.frame(scalewt(d07i, wt=d07$tot_inscrits))
wd08s <- data.frame(scalewt(d08i, wt=d08$tot_inscrits))
wd09s <- data.frame(scalewt(d09i, wt=d09$tot_inscrits))
wd10s <- data.frame(scalewt(d10i, wt=d10$tot_inscrits))
wd11s <- data.frame(scalewt(d11i, wt=d11$tot_inscrits))
wd12s <- data.frame(scalewt(d12i, wt=d12$tot_inscrits))
wd13s <- data.frame(scalewt(d13i, wt=d13$tot_inscrits))
wd14s <- data.frame(scalewt(d14i, wt=d14$tot_inscrits))

Labelling

row.names(wd97s) <- d97$numetab
row.names(wd98s) <- d98$numetab
row.names(wd99s) <- d99$numetab
row.names(wd00s) <- d00$numetab
row.names(wd01s) <- d01$numetab
row.names(wd02s) <- d02$numetab
row.names(wd03s) <- d03$numetab
row.names(wd04s) <- d04$numetab
row.names(wd05s) <- d05$numetab
row.names(wd06s) <- d06$numetab
row.names(wd07s) <- d07$numetab
row.names(wd08s) <- d08$numetab
row.names(wd09s) <- d09$numetab
row.names(wd10s) <- d10$numetab
row.names(wd11s) <- d11$numetab
row.names(wd12s) <- d12$numetab
row.names(wd13s) <- d13$numetab
row.names(wd14s) <- d14$numetab

K-tables assembling

lwds <- list(wd97s, wd98s, wd99s, wd00s, wd01s, wd02s, wd03s, wd04s, wd05s, wd06s,  wd07s, wd08s, wd09s, wd10s, wd11s, wd12s, wd13s, wd14s)

kwds <- ktab.list.df(lwds)

K-tables analysis

ptads <- pta(kwds, scannf = FALSE, nf=2)
mcoads <- mcoa(kwds, scannf = FALSE, nf=2)
mfads <- mfa(kwds, scannf=FALSE, nf=2)
statisds <- statis(kwds,  scannf = FALSE, nf = 2)

Plots

plot(ptads)
plot(mcoads)
plot(mfads)
plot(statisds)

K-plots

kplot(ptads)
kplot(mcoads)
kplot(mfads)
kplot(statisds)

Class and trajectory plots

s.class(ptads$Tli, dcs$numetab, col=rainbow(100))
s.traject(ptads$Tli, dcs$numetab, col=rainbow(100))
s.class(mcoads$Tli, dcs$numetab, col=rainbow(100))
s.traject(mcoads$Tli, dcs$numetab, col=rainbow(100))

Re-sorting

dcs2 <- dcs[order(session),]
head(dcs2)
##      session         patronyme       id_etab  numetab tot_inscrits
## 352     2003           COLBERT 0750673Z_2003 0750673Z          212
## 715     2014     HENRI BERGSON 0750711R_2014 0750711R          133
## 935     2012  GASTON BACHELARD 0770922J_2012 0770922J          197
## 1171    1997       GEORGE SAND 0771663P_1997 0771663P          199
## 1351    1997        JEAN VILAR 0772229E_1997 0772229E          277
## 1481    2008 DE LA MARE CARREE 0772296C_2008 0772296C          163
##         psucc    tx_btb    p_cs1    p_cs2    p_cs3     p_cs4    p_cs5
## 352  68.39623  2.758621 0.000000 9.433962 23.11321 12.735849 18.86792
## 715  67.66917  6.666667 1.503759 7.518797 30.82707  6.766917 24.81203
## 935  85.27919 26.190475 0.000000 5.076142 29.94924 26.395939 18.27411
## 1171 76.38191  3.947369 0.000000 5.025125 29.14573 25.125628 23.11558
## 1351 58.12275  3.105590 1.444043 5.054151 21.29964 18.411552 18.05054
## 1481 67.48467  7.272728 0.000000 4.294478 16.56442 25.766870 22.69939
##          p_cs6    p_cs7     p_cs8     p_cs9 cep cep2 codedep codecom
## 352  17.924528 3.301887 11.320755  3.301887   1    0      75     110
## 715   3.007519 3.007519 10.526316 12.030075   1    1      75     119
## 935   9.644671 3.553299  4.568528  2.538071   1    1      77     108
## 1171 12.562814 1.005025  3.015075  1.005025   1    0      77     285
## 1351 22.021660 2.527076  7.220217  3.971119   1    0      77     284
## 1481 17.791410 1.840491  7.361963  3.680982   1    0      77     296

Check

head(ptads$Tli)
##                        CS1          CS2
## 0750673Z.Ana1  0.402198828 -0.427390043
## 0750711R.Ana1  0.142674638 -0.100310876
## 0770922J.Ana1  0.894347068 -0.009410588
## 0771663P.Ana1  0.704504710  0.006962598
## 0772229E.Ana1 -0.006843246  0.230681280
## 0772296C.Ana1  0.713707749  0.252912577
head(mcoads$Tli)
##                     Axis1       Axis2
## 0750673Z.Ana1 -0.07772155  0.07455603
## 0750711R.Ana1 -0.02875942  0.02443772
## 0770922J.Ana1 -0.12615731 -0.00558298
## 0771663P.Ana1 -0.08780350 -0.01159594
## 0772229E.Ana1 -0.00757513 -0.05795082
## 0772296C.Ana1 -0.09695404 -0.04464101

Merging

xpta  <- cbind(ptads$Tli, dcs2)
xmcoa <- cbind(mcoads$Tli, dcs2)

Check

head(xpta)
##                        CS1          CS2 session         patronyme
## 0750673Z.Ana1  0.402198828 -0.427390043    2003           COLBERT
## 0750711R.Ana1  0.142674638 -0.100310876    2014     HENRI BERGSON
## 0770922J.Ana1  0.894347068 -0.009410588    2012  GASTON BACHELARD
## 0771663P.Ana1  0.704504710  0.006962598    1997       GEORGE SAND
## 0772229E.Ana1 -0.006843246  0.230681280    1997        JEAN VILAR
## 0772296C.Ana1  0.713707749  0.252912577    2008 DE LA MARE CARREE
##                     id_etab  numetab tot_inscrits    psucc    tx_btb
## 0750673Z.Ana1 0750673Z_2003 0750673Z          212 68.39623  2.758621
## 0750711R.Ana1 0750711R_2014 0750711R          133 67.66917  6.666667
## 0770922J.Ana1 0770922J_2012 0770922J          197 85.27919 26.190475
## 0771663P.Ana1 0771663P_1997 0771663P          199 76.38191  3.947369
## 0772229E.Ana1 0772229E_1997 0772229E          277 58.12275  3.105590
## 0772296C.Ana1 0772296C_2008 0772296C          163 67.48467  7.272728
##                  p_cs1    p_cs2    p_cs3     p_cs4    p_cs5     p_cs6
## 0750673Z.Ana1 0.000000 9.433962 23.11321 12.735849 18.86792 17.924528
## 0750711R.Ana1 1.503759 7.518797 30.82707  6.766917 24.81203  3.007519
## 0770922J.Ana1 0.000000 5.076142 29.94924 26.395939 18.27411  9.644671
## 0771663P.Ana1 0.000000 5.025125 29.14573 25.125628 23.11558 12.562814
## 0772229E.Ana1 1.444043 5.054151 21.29964 18.411552 18.05054 22.021660
## 0772296C.Ana1 0.000000 4.294478 16.56442 25.766870 22.69939 17.791410
##                  p_cs7     p_cs8     p_cs9 cep cep2 codedep codecom
## 0750673Z.Ana1 3.301887 11.320755  3.301887   1    0      75     110
## 0750711R.Ana1 3.007519 10.526316 12.030075   1    1      75     119
## 0770922J.Ana1 3.553299  4.568528  2.538071   1    1      77     108
## 0771663P.Ana1 1.005025  3.015075  1.005025   1    0      77     285
## 0772229E.Ana1 2.527076  7.220217  3.971119   1    0      77     284
## 0772296C.Ana1 1.840491  7.361963  3.680982   1    0      77     296
head(xmcoa)
##                     Axis1       Axis2 session         patronyme
## 0750673Z.Ana1 -0.07772155  0.07455603    2003           COLBERT
## 0750711R.Ana1 -0.02875942  0.02443772    2014     HENRI BERGSON
## 0770922J.Ana1 -0.12615731 -0.00558298    2012  GASTON BACHELARD
## 0771663P.Ana1 -0.08780350 -0.01159594    1997       GEORGE SAND
## 0772229E.Ana1 -0.00757513 -0.05795082    1997        JEAN VILAR
## 0772296C.Ana1 -0.09695404 -0.04464101    2008 DE LA MARE CARREE
##                     id_etab  numetab tot_inscrits    psucc    tx_btb
## 0750673Z.Ana1 0750673Z_2003 0750673Z          212 68.39623  2.758621
## 0750711R.Ana1 0750711R_2014 0750711R          133 67.66917  6.666667
## 0770922J.Ana1 0770922J_2012 0770922J          197 85.27919 26.190475
## 0771663P.Ana1 0771663P_1997 0771663P          199 76.38191  3.947369
## 0772229E.Ana1 0772229E_1997 0772229E          277 58.12275  3.105590
## 0772296C.Ana1 0772296C_2008 0772296C          163 67.48467  7.272728
##                  p_cs1    p_cs2    p_cs3     p_cs4    p_cs5     p_cs6
## 0750673Z.Ana1 0.000000 9.433962 23.11321 12.735849 18.86792 17.924528
## 0750711R.Ana1 1.503759 7.518797 30.82707  6.766917 24.81203  3.007519
## 0770922J.Ana1 0.000000 5.076142 29.94924 26.395939 18.27411  9.644671
## 0771663P.Ana1 0.000000 5.025125 29.14573 25.125628 23.11558 12.562814
## 0772229E.Ana1 1.444043 5.054151 21.29964 18.411552 18.05054 22.021660
## 0772296C.Ana1 0.000000 4.294478 16.56442 25.766870 22.69939 17.791410
##                  p_cs7     p_cs8     p_cs9 cep cep2 codedep codecom
## 0750673Z.Ana1 3.301887 11.320755  3.301887   1    0      75     110
## 0750711R.Ana1 3.007519 10.526316 12.030075   1    1      75     119
## 0770922J.Ana1 3.553299  4.568528  2.538071   1    1      77     108
## 0771663P.Ana1 1.005025  3.015075  1.005025   1    0      77     285
## 0772229E.Ana1 2.527076  7.220217  3.971119   1    0      77     284
## 0772296C.Ana1 1.840491  7.361963  3.680982   1    0      77     296

Export

write.dta(xpta, "xpta.dta")
write.dta(xmcoa, "xmcoa.dta")
cep_xpta <- summaryBy(CS1 + CS2 ~ session + cep2, data = xpta, FUN = function(x) { c(m = mean(x), s = sd(x)) } )


p_cep_xpta <- ggplot(cep_xpta, aes(CS1.m, CS2.m, label=session))

p_cep_xpta + geom_point() + geom_path(aes(colour = session)) + geom_text() +  facet_wrap( ~ cep2, ncol=1) + labs(title = "Trajectoire sociale des établissements CEP franciliens - PTA")
cep_xmcoa <- summaryBy(Axis1 + Axis2 ~ session + cep2, data = xmcoa, FUN = function(x) { c(m = mean(x), s = sd(x)) } )


p_cep_xmcoa <- ggplot(cep_xmcoa, aes(Axis1.m, Axis2.m, label=session))

p_cep_xmcoa + geom_point() + geom_path(aes(colour = session)) + geom_text() +  facet_wrap( ~ cep2, ncol=1) + labs(title = "Trajectoire sociale des établissements CEP franciliens - MCOA")

Graphics

ppta <- ggplot(xpta, aes(CS1, CS2))
ppta + geom_path(aes(colour = session))
ppta + geom_path(aes(colour = session)) +  facet_wrap( ~ numetab, ncol=10)
ppta + geom_path(aes(colour = session)) +  facet_wrap( ~ patronyme, ncol=10)
pmcoa <- ggplot(xmcoa, aes(Axis1, Axis2))
pmcoa + geom_path(aes(colour = session))
pmcoa + geom_path(aes(colour = session)) +  facet_wrap( ~ numetab, ncol=10)
pmcoa + geom_path(aes(colour = session)) +  facet_wrap( ~ patronyme, ncol=10)

To collapse under stata

collapse (mean) CS1 CS2, by( cep2 codedep session)
line CS1 session if cep==0, color(blue) || line CS1 session if cep==1, color(red) by(codedep)